package com.yanqu.road.entity.activity.douluodalu.config;

import com.yanqu.road.entity.activity.ActivityConfig;
import com.yanqu.road.entity.activity.ActivityInfo;
import com.yanqu.road.entity.activity.douluodalu.enums.eDouLuoDaLuBuffType;
import com.yanqu.road.entity.activity.douluodalu.enums.eDouLuoDaLuEventType;
import com.yanqu.road.entity.activity.gourdchild.config.GourdMountainControl;
import com.yanqu.road.entity.config.goods.MallInfo;
import com.yanqu.road.entity.enums.eActivityConfigType;
import com.yanqu.road.utils.string.StringUtils;
import org.apache.commons.collections.map.HashedMap;

import java.util.*;
import java.util.concurrent.ConcurrentHashMap;

public class DouLuoDaLuConfig {

    /**
     * 猎魂积分道具ID
     */
    public int SCORE_ITEM_ID_FOREST = 101987;
    /**
     * 魂师对决积分道具ID
     */
    public int SCORE_ITEM_ID_FIGHT = 101988;
    /**
     * 体力包道具ID
     */
    public int ENERGY_ITEM_ID = 120606;
    /**
     * 队伍名字字符上限
     */
    public int TEAM_NAME_LENGTH_LIMIT = 6;
    /**
     * 创建队伍元宝消耗
     */
    public long TEAM_CREATE_NEED_INGOTS = 100;
    /**
     * 申请队伍上限条数
     */
    public int TEAM_APPLY_MAX_LIMIT = 4;
    /**
     * 玩家申请队伍上限
     */
    public int TEAM_USER_APPLY_MAX_LIMIT = 3;
    /**
     * 重新入队CD时间(s)
     */
    public int TEAM_JOIN_CD = 7200;
    /**
     * 体力CD时间（s）
     */
    public int ENERGY_CD = 3600;
    /**
     * 体力CD恢复值
     */
    public int ENERGY_CD_NUM = 1;
    /**
     * 玩家体力值
     */
    public int ENERGY_MAX = 20;
    /**
     * 元宝购买体力消耗
     */
    public String ENERGY_BUYCOST = "100|200|500";

    /**
     * 组队时长
     */
    public long CREATE_TEAM_TIME = 2040;

    /**
     * 胜利者抢夺失败者前n个中随机一个魂环
     */
    public int FOREST_SEIZE_RANDOMNUM = 10;
    /**
     * 玩家魂环少于n不掉落魂环
     */
    public int FOREST_SEIZE_LIMIT = 20;
    /**
     * 抢夺魂环概率（百分比）
     */
    public int FOREST_SEIZE_PRO = 100;
    /**
     * 标记怪物次数上限
     */
    public int FOREST_MARK_LIMIT = 5;
    /**
     * 史莱克七怪事件保底次数
     */
    public String FOREST_SEVENTEVENT_SECURITY_NUM = "7|6|5|4|3|2";
    /**
     * PVP事件保护时间(s)
     */
    public int FOREST_PROTECT_TIME = 60;
    /**
     * 攻击冷却CD时间（s）
     */
    public int FOREST_ATTACK_CD = 7200;
    /**
     * 玩家初始斗魂积分
     */
    public long FIGHT_PLAYER_SCORE_BEGIN = 1000L;
    /**
     * 匹配排名前后n名次
     */
    public int FIGHT_MATCH_NUM = 15;

    /**
     * 玩家免费匹配对手的次数
     */
    public int FIGHT_GUEST_FREETIMES = 6;

    /**
     * 门客派遣次数
     */
    public int FIGHT_GUEST_PAIQIAN = 1;

    /**
     * 门客挑战次数
     */
    public int FIGHT_GUEST_OUT = 1;
    /**
     * 门客追捕次数
     */
    public int FIGHT_GUEST_ZHUIBU = 1;

    /**
     * 购买消耗  "50|100|200"
     */
    public List<Integer> FIGHT_BUFF_COST;
    /**
     * 首次增幅（百分比） "50|100|200"
     */
    public List<Integer> FIGHT_BUFF_FIRSTADD;

    /**
     * 正常增幅（百分比） "5|10|20"
     */
    public List<Integer> FIGHT_BUFF_ADD;
    /**
     * 进攻方得分|防守方失分
     * "2|1"
     */
    public String FIGHT_SCORE_DEAL = "2|1";
    /**
     * 一键挑战解锁条件（次）
     */
    public int FIGHT_QUICKFIGHT_LIMIT_NUM = 3;
    /**
     * 一键挑战时间限制（活动结束前n分钟不允许使用）
     */
    public int FIGHT_QUICKFIGHT_LIMIT_TIME_FINISH = 60;
    /**
     * 被攻击次数上限（被挑战、追捕）
     */
    public int FIGHT_ATTACKED_MAX = 50;
    /**
     * 战胜n名门客后上日志
     */
    public int FIGHT_LOG_BEATNUM = 30;
    /**
     * 日志显示上限
     */
    public int FIGHT_LOG_LIMIT = 50;
    /**
     * 聊天显示上限
     */
    public int FIGHT_CHAT_LIMIT = 100;
    /**
     * 获取可申请的队伍每页队伍个数
     */
    public int FIGHT_GET_TEAM_LIST_PAGE_NUM = 50;
    /**
     * 每日开启时间(h)
     */
    public int FIGHT_DAILY_OPEN_TIME_1 = 10;
    /**
     * 森林每日结束时间(h)
     */
    public int FIGHT_DAILY_END_TIME_1 = 19;

    /**
     * 森林每日开启时间(h)
     */
    public int FIGHT_DAILY_OPEN_TIME_2 = 19;

    /**
     * 对决每日结束时间(h)
     */
    public int FIGHT_DAILY_END_TIME_2 = 22;

    /**
     * 对决挑战消耗道具ID
     */
    public int TIAOZHAN_ITEM_ID = 0;

    /**
     * 追捕消耗道具ID
     */
    public int ZHUIBU_ITEM_ID = 0;

    /**
     * 试炼宝库奖励
     */
    public String BAOKU_REWARD = "";
    /**
     * 试炼宝库奖励
     */
    public List<HideRewardDrawItem> drawItemList;
    /**
     * 前n次抽盲盒，活动共享m*服务器数量个隐藏款；抽取的概率千分比
     */
    private List<Integer> luckyParam;
    /**
     * m*服务器数量
     */
    private int hideBoxCount;
    /**
     * 累计抽取m次后，每次抽取增加权重
     */
    private List<Integer> additionParam;
    /**
     * 试炼宝库保底次数，4;20 代表当前抽奖达到20次时，若总获取低于4个不重复的，则下次一定获得新奖励
     */
    private List<GourdMountainControl> controlList;

    /**
     * 试炼宝库单次消耗试炼石
     */
    public String BAOKU_COST = "101001=10";

    /**
     * 首次购买消耗
     */
    public List<Integer> FIGHT_BUFF_COST_FIRST;

    /**
     * 体力消耗超过n跳过搜索动画
     */
    public int ENERGY_COST_JUMPANI = 10;

    /**
     * 魂环效果
     */
    public String HUNHUAN_BUFF = "";

    /**
     * 仙草效果
     */
    public String XIANCAO_BUFF = "";

    /**
     * 区域配置
     */
    List<DouLuoDaLuRegionInfo> regionInfoList = new ArrayList<>();

    /**
     * 事件配置
     */
    List<DouLuoDaLuEventInfo> eventInfoList = new ArrayList<>();

    /**
     * 真人事件ID
     */
    List<Integer> playerEventId = new ArrayList<>();

    /**
     * 七怪事件ID
     */
    List<Integer> sevenEventId = new ArrayList<>();

    /**
     * 魂环效果
     */
    Map<Integer, List<Integer>> hunHuanBuffMap = new HashedMap();

    /**
     * 仙草效果
     */
    Map<Integer, List<Integer>> xiaoCaoBuffMap = new HashedMap();

    Map<Integer, Integer> sevenEventLimitMap = new TreeMap<>();

    /**
     * 连胜奖励 递进 宝箱ID
     * 1,5,121085|6,10,121104|11,20,121105|21,26,121106
     */
    public String FIGHT_REWARD_WIN;

    public int initHelpTimes = 200; //初始化协助次数
    public int helpConsumeHp = 20;
    public int helpAddTimes = 1;

    public int getWinRewardBox(int winTimes){
        int rewardTimes = winTimes / FIGHT_REWARD_COMBONUM;
        List<String> itemString = StringUtils.stringToStringList(FIGHT_REWARD_WIN, "\\|");
        for (int i = 0; i < itemString.size(); i++) {
            String itemConfig = itemString.get(i);
            List<Integer> rangeList = StringUtils.stringToIntegerList(itemConfig, ",");
            if(rangeList.size() != 3){
                continue;
            }
            if(rewardTimes >= rangeList.get(0) && rewardTimes <= rangeList.get(1)){
                return rangeList.get(2);
            }
            if(i == itemString.size() -1){
                return rangeList.get(2);
            }
        }
        return 0;
    }

    /**
     * 连胜次数后获得连胜奖励
     */
    public int FIGHT_REWARD_COMBONUM = 3;

    /**
     * 胜利对决奖励|失败对决奖励
     */
    public String FIGHT_REWARD_END;


    /**
     * 现金礼包
     */
    public Map<Integer, Map<Integer, MallInfo>> rmbMallInfoTypeMap = new ConcurrentHashMap<>(); //rmb礼包 k:type k:vip,v:MallInfo

    /**
     * 现金礼包-有效期
     */
    public int MALL_KEEP_TIME = 3600 * 4;

    /**
     * 开启宝箱的消耗  宝箱id + 消耗
     * 改为 事件id , 消耗
     */
    private Map<Integer, String> boxOpenConsume = new HashMap();
    /**
     * 开启宝箱是否有公告  宝箱id
     * 改为 事件id
     */
    private List<Integer> boxShowLog = new ArrayList<>();

    /**
     * 奥斯卡专卖BUFF道具id
     */
    public String FIGHT_BUFF_ITEM_ID = "120649|120650|120651";

    public List<Integer> fightBuffItemIdList;

    /**
     * 挑战消耗道具数量
     */
    public int TIAOZHAN_ITEM_NUM = 1;

    /**
     * 追捕消耗道具数量
     */
    public int ZHUIBU_ITEM_NUM = 1;

    /**
     * 追捕/挑战奖励翻倍
     */
    public int FIGHT_FANBEI = 2;

    /**
     * 是否支持跨服组队（1：支持；0：不支持）
     */
    public int TEAM_JOIN_KUAFU = 1;

    /**
     * 怪物血量计算保底递增千分比
     */
    public int FOREST_CAlC_HP_ADD_PAR = 1100;

    /**
     * 计算NPC血量浮动值区间(百分比)
     */
    public String FOREST_FLOAT_VALUE = "95;105";

    /**
     * 计算NPC血量浮动值区间(百分比)
     */
    public List<Integer> floatValueList;

    /**
     * 一键挑战解锁条件（VIP）
     */
    public int FIGHT_QUICKFIGHT_LIMIT_VIP = 3;

    /**
     * 低等级魂环标识，比这个魂环年限小的都是低等级，包括这个魂环
     */
    public int FOREST_LOWRING = 120636;

    public List<Integer> eventBoxExchangeCond = new ArrayList<>();

    public List<Integer> eventPvpExchangeId = new ArrayList<>();

    public List<Integer> eventLowBoxExchangeId = new ArrayList<>();

    public List<Integer> eventHighBoxExchangeId = new ArrayList<>();


    /**
     * 获取仙草效果加成值
     */
    public int getXianCaoBuffAddition(eDouLuoDaLuBuffType buffType){
        List<Integer> buffList = xiaoCaoBuffMap.get(buffType.getId());
        if(buffList == null || buffList.size() <= buffType.getIndex()){
            return 0;
        }
        return buffList.get(buffType.getIndex());
    }

    /**
     * 获取仙草生效次数（每次遇到）
     */
    public int getXianCaoBuffTimes(eDouLuoDaLuBuffType buffType){
        List<Integer> buffList = xiaoCaoBuffMap.get(buffType.getId());
        if(buffList == null || buffList.size() < 1){
            return 0;
        }
        return buffList.get(0);
    }

    /**
     * 获取仙草体力恢复
     */
    public int getXianCaoBuffEnergy(eDouLuoDaLuBuffType buffType){
        List<Integer> buffList = xiaoCaoBuffMap.get(buffType.getId());
        if(buffList == null || buffList.size() < 4){
            return 0;
        }
        return buffList.get(4);
    }

    public DouLuoDaLuRegionInfo getRegionInfo(int regionId) {
        for (DouLuoDaLuRegionInfo regionInfo : regionInfoList) {
            if(regionId == regionInfo.getRegionId()){
                return regionInfo;
            }
        }
        return null;
    }

    public DouLuoDaLuEventInfo getEventInfo(int eventId){
        for (DouLuoDaLuEventInfo daLuEventInfo : eventInfoList) {
            if(eventId == daLuEventInfo.getEventId()){
                return daLuEventInfo;
            }
        }
        return null;
    }

    public DouLuoDaLuRegionInfo getFirstRegionInfo(){
        if(regionInfoList.size() > 0){
            return regionInfoList.get(0);
        }
        return null;
    }

    public DouLuoDaLuRegionInfo getNextRegionInfo(int regionId){
        int index = -1;
        for (int i = 0; i < regionInfoList.size(); i++) {
            if(regionInfoList.get(i).getRegionId() == regionId){
                index = i;
            }
        }
        if(index != -1 && index + 1 < regionInfoList.size()){
            return regionInfoList.get(index + 1);
        }
        return null;
    }

    public int getRegionIdx(int regionId){
        for (int i = 0; i < regionInfoList.size(); i++) {
            if(regionId == regionInfoList.get(i).getRegionId()){
                return i;
            }
        }
        return 0;
    }

    public DouLuoDaLuRegionInfo getPreRegionInfo(int regionId){
        int index = -1;
        for (int i = 0; i < regionInfoList.size(); i++) {
            if(regionInfoList.get(i).getRegionId() == regionId){
                index = i;
            }
        }
        if(index != -1 && index - 1 >= 0){
            return regionInfoList.get(index - 1);
        }
        return null;
    }

    public boolean hasWinRewards(int winTimes){
        return winTimes % FIGHT_REWARD_COMBONUM == 0;
    }

    /**
     * 是否一定七怪赠礼事件
     */
    public boolean hasSevenSecurity(int regionId, int times){
        int regionIdx = getRegionIdx(regionId);
        List<Integer> baoDi = StringUtils.stringToIntegerList(FOREST_SEVENTEVENT_SECURITY_NUM, "\\|");
        //当超出下标，使用最后一个
        if(regionIdx > baoDi.size() - 1){
            regionIdx = baoDi.size() - 1;
        }
        return (times + 1) % (baoDi.get(regionIdx) + 1) == 0;
    }

    /**
     * 获取某类型事件
     * @param eventType
     */
    public List<DouLuoDaLuEventInfo> getEventInfoList(int eventType){
        List<DouLuoDaLuEventInfo> result = new ArrayList<>();
        for (DouLuoDaLuEventInfo daLuEventInfo : eventInfoList) {
            if(eventType == daLuEventInfo.getEventType()){
                result.add(daLuEventInfo);
            }
        }
        return result;
    }

    public List<DouLuoDaLuRegionInfo> getRegionInfoList() {
        return regionInfoList;
    }

    public void setRegionInfoList(List<DouLuoDaLuRegionInfo> regionInfoList) {
        this.regionInfoList = regionInfoList;
    }

    public List<DouLuoDaLuEventInfo> getEventInfoList() {
        return eventInfoList;
    }

    public void setEventInfoList(List<DouLuoDaLuEventInfo> eventInfoList) {
        this.eventInfoList = eventInfoList;
    }

    public List<Integer> getPlayerEventId() {
        return playerEventId;
    }

    public Map<Integer, List<Integer>> getHunHuanBuffMap() {
        return hunHuanBuffMap;
    }

    public void setHunHuanBuffMap(Map<Integer, List<Integer>> hunHuanBuffMap) {
        this.hunHuanBuffMap = hunHuanBuffMap;
    }

    public Map<Integer, List<Integer>> getXiaoCaoBuffMap() {
        return xiaoCaoBuffMap;
    }

    public void setXiaoCaoBuffMap(Map<Integer, List<Integer>> xiaoCaoBuffMap) {
        this.xiaoCaoBuffMap = xiaoCaoBuffMap;
    }

    public Map<Integer, Map<Integer, MallInfo>> getRmbMallInfoTypeMap() {
        return rmbMallInfoTypeMap;
    }

    public void setRmbMallInfoTypeMap(Map<Integer, Map<Integer, MallInfo>> rmbMallInfoTypeMap) {
        rmbMallInfoTypeMap = rmbMallInfoTypeMap;
    }

    public List<Integer> getFloatValueList() {
        return floatValueList;
    }

    public void setFloatValueList(List<Integer> floatValueList) {
        this.floatValueList = floatValueList;
    }

    public Map<Integer, String> getBoxOpenConsume() {
        return boxOpenConsume;
    }

    public List<Integer> getBoxShowLog() {
        return boxShowLog;
    }

    public List<Integer> getFightBuffItemIdList() {
        return fightBuffItemIdList;
    }

    public void setFightBuffItemIdList(List<Integer> fightBuffItemIdList) {
        this.fightBuffItemIdList = fightBuffItemIdList;
    }

    public List<HideRewardDrawItem> getDrawItemList() {
        return drawItemList;
    }

    public void setDrawItemList(List<HideRewardDrawItem> drawItemList) {
        this.drawItemList = drawItemList;
    }

    public List<Integer> getSevenEventId() {
        return sevenEventId;
    }

    public void setSevenEventId(List<Integer> sevenEventId) {
        this.sevenEventId = sevenEventId;
    }

    public List<Integer> getLuckyParam() {
        return luckyParam;
    }

    public void setLuckyParam(List<Integer> luckyParam) {
        this.luckyParam = luckyParam;
    }

    public int getHideBoxCount() {
        return hideBoxCount;
    }

    public void setHideBoxCount(int hideBoxCount) {
        this.hideBoxCount = hideBoxCount;
    }

    public List<Integer> getAdditionParam() {
        return additionParam;
    }

    public void setAdditionParam(List<Integer> additionParam) {
        this.additionParam = additionParam;
    }

    public List<GourdMountainControl> getControlList() {
        return controlList;
    }

    public void setControlList(List<GourdMountainControl> controlList) {
        this.controlList = controlList;
    }

    public static void parseBoxOpenConsume(DouLuoDaLuConfig tempConfig){
        for (DouLuoDaLuEventInfo eventInfo : tempConfig.eventInfoList) {
            if(eventInfo.getEventType() == eDouLuoDaLuEventType.MonsterBoxEvent.getIntValue()){

                //可以不另外存了，直接读配置
                //List<Integer> item = StringUtils.stringToIntegerList(eventInfo.getRewards(), "=");
                int boxId = Integer.parseInt(eventInfo.getTargetId());
                tempConfig.getBoxOpenConsume().put(boxId, eventInfo.getParam());
                if(eventInfo.showLog){
                    tempConfig.getBoxShowLog().add(boxId);
                }
            }
        }
    }

    public static List<HideRewardDrawItem> parseDrawItemConfig(String itemParam){
        List<HideRewardDrawItem> itemList = new ArrayList<>();
        List<String> tempList = StringUtils.stringToStringList(itemParam, "\\|");
        for (String s : tempList) {
            List<Integer> integers = StringUtils.stringToIntegerList(s, ";");
            HideRewardDrawItem item = new HideRewardDrawItem();
            item.setItemId(integers.get(0));
            item.setWeight(integers.get(1));
            item.setHide(integers.get(2) == 1 ? true : false);
            itemList.add(item);
        }
        return itemList;
    }

    public static List<GourdMountainControl> parseDrawControl(String itemParam){
        List<String> tempList = StringUtils.stringToStringList(itemParam, "\\|");
        List<GourdMountainControl> controlList = new ArrayList<>();
        for (String s : tempList) {
            List<Integer> integers = StringUtils.stringToIntegerList(s, ";");
            GourdMountainControl item = new GourdMountainControl();
            item.setDistinct(integers.get(0));
            item.setTimes(integers.get(1));
            controlList.add(item);
        }
        return controlList;
    }

    public static void parseConfig(DouLuoDaLuConfig tempConfig, Map<String, ActivityConfig> activityConfigMap, ActivityInfo activityInfo){

        //配置项
        tempConfig.SCORE_ITEM_ID_FOREST = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_SCORE_ITEM_ID_FOREST.getName()).getIntValue();
        tempConfig.SCORE_ITEM_ID_FIGHT = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_SCORE_ITEM_ID_FIGHT.getName()).getIntValue();
        tempConfig.ENERGY_ITEM_ID = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_ENERGY_ITEM_ID.getName()).getIntValue();
        //中文长度
        tempConfig.TEAM_NAME_LENGTH_LIMIT = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_TEAM_NAME_LENGTH_LIMIT.getName()).getIntValue() * 2;
        tempConfig.TEAM_CREATE_NEED_INGOTS = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_TEAM_CREATE_NEED_INGOTS.getName()).getLongValue();
        tempConfig.TEAM_APPLY_MAX_LIMIT = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_TEAM_APPLY_MAX_LIMIT.getName()).getIntValue();
        tempConfig.TEAM_USER_APPLY_MAX_LIMIT = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_TEAM_USER_APPLY_MAX_LIMIT.getName()).getIntValue();
        tempConfig.TEAM_JOIN_CD = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_TEAM_JOIN_CD.getName()).getIntValue();
        tempConfig.ENERGY_CD = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_ENERGY_CD.getName()).getIntValue();
        tempConfig.ENERGY_CD_NUM = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_ENERGY_CD_NUM.getName()).getIntValue();
        tempConfig.ENERGY_MAX = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_ENERGY_MAX.getName()).getIntValue();
        tempConfig.ENERGY_BUYCOST = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_ENERGY_BUYCOST.getName()).getValue();
        tempConfig.FOREST_SEIZE_RANDOMNUM = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_FOREST_SEIZE_RANDOMNUM.getName()).getIntValue();
        tempConfig.FOREST_SEIZE_LIMIT = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_FOREST_SEIZE_LIMIT.getName()).getIntValue();
        tempConfig.FOREST_SEIZE_PRO = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_FOREST_SEIZE_PRO.getName()).getIntValue();
        tempConfig.FOREST_MARK_LIMIT = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_FOREST_MARK_LIMIT.getName()).getIntValue();
        tempConfig.FOREST_SEVENTEVENT_SECURITY_NUM = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_FOREST_SEVENTEVENT_SECURITY_NUM.getName()).getValue();
        tempConfig.FOREST_PROTECT_TIME = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_FOREST_PROTECT_TIME.getName()).getIntValue();
        tempConfig.FOREST_ATTACK_CD = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_FOREST_ATTACK_CD.getName()).getIntValue();
        tempConfig.FIGHT_PLAYER_SCORE_BEGIN = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_FIGHT_PLAYER_SCORE_BEGIN.getName()).getIntValue();

        tempConfig.FIGHT_MATCH_NUM = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_FIGHT_MATCH_NUM.getName()).getIntValue();
        tempConfig.FIGHT_GUEST_FREETIMES = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_FIGHT_GUEST_FREETIMES.getName()).getIntValue();
        tempConfig.FIGHT_GUEST_PAIQIAN = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_FIGHT_GUEST_PAIQIAN.getName()).getIntValue();
        tempConfig.FIGHT_GUEST_OUT = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_FIGHT_GUEST_OUT.getName()).getIntValue();
        if(activityConfigMap.containsKey(eActivityConfigType.DOULUOFIGHT_FIGHT_GUEST_ZHUIBU.getName())){
            tempConfig.FIGHT_GUEST_ZHUIBU = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_FIGHT_GUEST_ZHUIBU.getName()).getIntValue();
        }

        tempConfig.FIGHT_BUFF_COST_FIRST = StringUtils.stringToIntegerList(activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_FIGHT_BUFF_COST_FIRST.getName()).getValue(), "\\|");
        tempConfig.FIGHT_BUFF_COST = StringUtils.stringToIntegerList(activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_FIGHT_BUFF_COST.getName()).getValue(), "\\|");
        tempConfig.FIGHT_BUFF_FIRSTADD = StringUtils.stringToIntegerList(activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_FIGHT_BUFF_FIRSTADD.getName()).getValue(), "\\|");
        tempConfig.FIGHT_BUFF_ADD = StringUtils.stringToIntegerList(activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_FIGHT_BUFF_ADD.getName()).getValue(), "\\|");
        tempConfig.FIGHT_SCORE_DEAL = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_FIGHT_SCORE_DEAL.getName()).getValue();
        tempConfig.FIGHT_QUICKFIGHT_LIMIT_NUM = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_FIGHT_QUICKFIGHT_LIMIT_NUM.getName()).getIntValue();
        tempConfig.FIGHT_QUICKFIGHT_LIMIT_TIME_FINISH = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_FIGHT_QUICKFIGHT_LIMIT_TIME_FINISH.getName()).getIntValue();
        tempConfig.FIGHT_ATTACKED_MAX = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_FIGHT_ATTACKED_MAX.getName()).getIntValue();

        tempConfig.FIGHT_LOG_BEATNUM = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_FIGHT_LOG_BEATNUM.getName()).getIntValue();
        tempConfig.FIGHT_LOG_LIMIT = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_LOG_LIMIT.getName()).getIntValue();
        tempConfig.FIGHT_CHAT_LIMIT = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_CHAT_LIMIT.getName()).getIntValue();
        tempConfig.FIGHT_GET_TEAM_LIST_PAGE_NUM = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_GET_TEAM_LIST_PAGE_NUM.getName()).getIntValue();

        tempConfig.FIGHT_DAILY_OPEN_TIME_1 = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_DAILY_OPEN_TIME_1.getName()).getIntValue();
        tempConfig.FIGHT_DAILY_END_TIME_1 = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_DAILY_END_TIME_1.getName()).getIntValue();
        tempConfig.FIGHT_DAILY_OPEN_TIME_2 = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_DAILY_OPEN_TIME_2.getName()).getIntValue();
        tempConfig.FIGHT_DAILY_END_TIME_2 = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_DAILY_END_TIME_2.getName()).getIntValue();

        tempConfig.CREATE_TEAM_TIME = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_CREATE_TEAM_TIME.getName()).getIntValue();
        tempConfig.TIAOZHAN_ITEM_ID = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_TIAOZHAN_ITEM_ID.getName()).getIntValue();
        tempConfig.ZHUIBU_ITEM_ID = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_ZHUIBU_ITEM_ID.getName()).getIntValue();

        //宝库抽奖
        tempConfig.BAOKU_REWARD = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_BAOKU_REWARD.getName()).getValue();
        tempConfig.setDrawItemList(parseDrawItemConfig(tempConfig.BAOKU_REWARD));
        tempConfig.setLuckyParam(StringUtils.stringToIntegerList(activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_BAOKU_LUCKY_PARAM.getName()).getValue(), ";"));
        tempConfig.setHideBoxCount(tempConfig.getLuckyParam().get(1) * activityInfo.getServerIdList().size());
        tempConfig.setAdditionParam(StringUtils.stringToIntegerList(activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_BAOKU_ADDITION_PARAM.getName()).getValue(), ";"));
        tempConfig.setControlList(parseDrawControl(activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_BAOKU_REWARD_REPEAT_CONTROL.getName()).getValue()));
        tempConfig.BAOKU_COST = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_BAOKU_COST.getName()).getValue();
        //tempConfig.ENERGY_COST_JUMPANI = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_ENERGY_COST_JUMPANI.getName()).getIntValue();

        tempConfig.FIGHT_REWARD_WIN = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_FIGHT_REWARD_WIN.getName()).getValue();

        tempConfig.FIGHT_REWARD_COMBONUM = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_FIGHT_REWARD_COMBONUM.getName()).getIntValue();
        tempConfig.FIGHT_REWARD_END = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_FIGHT_REWARD_END.getName()).getValue();

        tempConfig.HUNHUAN_BUFF = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_HUNHUAN_BUFF.getName()).getValue();
        tempConfig.XIANCAO_BUFF = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_XIANCAO_BUFF.getName()).getValue();

        tempConfig.TIAOZHAN_ITEM_NUM = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_TIAOZHAN_ITEM_NUM.getName()).getIntValue();
        tempConfig.ZHUIBU_ITEM_NUM = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_ZHUIBU_ITEM_NUM.getName()).getIntValue();

        tempConfig.FIGHT_FANBEI = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_FIGHT_FANBEI.getName()).getIntValue();

        if(activityConfigMap.containsKey(eActivityConfigType.DOULUOFIGHT_TEAM_JOIN_KUAFU.getName())){
            tempConfig.TEAM_JOIN_KUAFU = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_TEAM_JOIN_KUAFU.getName()).getIntValue();
        }

        if(activityConfigMap.containsKey(eActivityConfigType.DOULUOFIGHT_FIGHT_QUICKFIGHT_LIMIT_VIP.getName())){
            tempConfig.FIGHT_QUICKFIGHT_LIMIT_VIP = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_FIGHT_QUICKFIGHT_LIMIT_VIP.getName()).getIntValue();
        }

        if(activityConfigMap.containsKey(eActivityConfigType.DOULUOFIGHT_FIGHT_BUFF_ITEM_ID.getName())) {
            tempConfig.FIGHT_BUFF_ITEM_ID = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_FIGHT_BUFF_ITEM_ID.getName()).getValue();
        }
        tempConfig.setFightBuffItemIdList(StringUtils.stringToIntegerList(tempConfig.FIGHT_BUFF_ITEM_ID, "\\|"));

        if(activityConfigMap.containsKey(eActivityConfigType.DOULUOFIGHT_FOREST_FLOAT_VALUE.getName())) {
            tempConfig.FOREST_FLOAT_VALUE = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_FOREST_FLOAT_VALUE.getName()).getValue();
        }

        if(activityConfigMap.containsKey(eActivityConfigType.DOULUOFIGHT_FOREST_CAlC_HP_ADD_PAR.getName())) {
            tempConfig.FOREST_CAlC_HP_ADD_PAR = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_FOREST_CAlC_HP_ADD_PAR.getName()).getIntValue();
        }

        tempConfig.floatValueList = StringUtils.stringToIntegerList(tempConfig.FOREST_FLOAT_VALUE, ";");

        tempConfig.MALL_KEEP_TIME = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_MALL_KEEP_TIME.getName()).getIntValue();

        if(activityConfigMap.containsKey(eActivityConfigType.DOULUOFIGHT_FOREST_LOWRING.getName())){
            tempConfig.FOREST_LOWRING = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_FOREST_LOWRING.getName()).getIntValue();
        }

        if (activityConfigMap.containsKey(eActivityConfigType.DOULUOFIGHT_EVENT_BOX_EXCHANGE_COND.getName())) {
            tempConfig.eventBoxExchangeCond = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_EVENT_BOX_EXCHANGE_COND.getName()).getIntListValue("\\|");
        }

        if (activityConfigMap.containsKey(eActivityConfigType.DOULUOFIGHT_EVENT_PVP_EXCHANGE_ID.getName())) {
            tempConfig.eventPvpExchangeId = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_EVENT_PVP_EXCHANGE_ID.getName()).getIntListValue("\\|");
        }

        if (activityConfigMap.containsKey(eActivityConfigType.DOULUOFIGHT_EVENT_LOW_BOX_EXCHANGE_ID.getName())) {
            tempConfig.eventLowBoxExchangeId = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_EVENT_LOW_BOX_EXCHANGE_ID.getName()).getIntListValue("\\|");
        }

        if (activityConfigMap.containsKey(eActivityConfigType.DOULUOFIGHT_EVENT_HIGH_BOX_EXCHANGE_ID.getName())) {
            tempConfig.eventHighBoxExchangeId = activityConfigMap.get(eActivityConfigType.DOULUOFIGHT_EVENT_HIGH_BOX_EXCHANGE_ID.getName()).getIntListValue("\\|");
        }

        List<String> buffList = StringUtils.stringToStringList(tempConfig.HUNHUAN_BUFF, "\\|");
        for (String buff : buffList) {
            List<Integer> buffValList = StringUtils.stringToIntegerList(buff,",");
            if(buffValList.size() == 3){
                List<Integer> valueList = new ArrayList<>();
                valueList.add(buffValList.get(1));
                valueList.add(buffValList.get(2));
                tempConfig.getHunHuanBuffMap().put(buffValList.get(0), valueList);
            }
        }

        buffList = StringUtils.stringToStringList(tempConfig.XIANCAO_BUFF, "\\|");
        for (String buff : buffList) {
            List<Integer> buffValList = StringUtils.stringToIntegerList(buff,",");
            if(buffValList.size() == 6){
                List<Integer> valueList = new ArrayList<>();
                valueList.add(buffValList.get(1));//次数
                valueList.add(buffValList.get(2));//积分加成百分比
                valueList.add(buffValList.get(3));//道具加成百分比
                valueList.add(buffValList.get(4));//伤害加成百分比
                valueList.add(buffValList.get(5));//体力增加固定值（恢复）
                tempConfig.getXiaoCaoBuffMap().put(buffValList.get(0), valueList);
            }
        }

        if (activityConfigMap.containsKey("DOULUOFIGHT_INIT_HELP_TIMES")) {
            tempConfig.initHelpTimes = activityConfigMap.get("DOULUOFIGHT_INIT_HELP_TIMES").getIntValue();

        }
        if (activityConfigMap.containsKey("DOULUOFIGHT_CONSUME_ENERGY_HELP_TIMES")) {
            String helpTimesStr = activityConfigMap.get("DOULUOFIGHT_CONSUME_ENERGY_HELP_TIMES").getValue();
            String[] arr = helpTimesStr.split(",");
            tempConfig.helpConsumeHp = Integer.parseInt(arr[0]);
            tempConfig.helpAddTimes = Integer.parseInt(arr[1]);
        }
        Map<Integer, Integer> sevenEventLimitMap = new TreeMap<>();
        if (activityConfigMap.containsKey("DOULUOFIGHT_FOREST_SEVENTEVENT_LIMIT")) {
            String seventeventLimit = activityConfigMap.get("DOULUOFIGHT_FOREST_SEVENTEVENT_LIMIT").getValue();
            String[] arr = seventeventLimit.split(";");
            for (String s : arr) {
                String[] split = s.split("=");
                int num = Integer.parseInt(split[0]);
                int param = Integer.parseInt(split[1]);
                sevenEventLimitMap.put(num, param);
            }
        }
        tempConfig.sevenEventLimitMap = sevenEventLimitMap;

    }

    public void setSevenEventLimitMap(Map<Integer, Integer> sevenEventLimitMap) {
        this.sevenEventLimitMap = sevenEventLimitMap;
    }

    public int getSevenEventWeight(int weight, long stoneNum) {
        int param = 1000;
        int key = 0;
        for (Map.Entry<Integer, Integer> entry : sevenEventLimitMap.entrySet()) {
            Integer num = entry.getKey();
            if (stoneNum >= num && num > key) {
                key = num;
            }
        }
        Integer paramValue = sevenEventLimitMap.get(key);
        if (paramValue != null) {
            param = paramValue;
        }
        int value = (int) (weight * param / 1000.0);
        return value;
    }

    public List<Integer> getEventBoxExchangeCond() {
        return eventBoxExchangeCond;
    }

    public List<Integer> getEventPvpExchangeId() {
        return eventPvpExchangeId;
    }

    public List<Integer> getEventLowBoxExchangeId() {
        return eventLowBoxExchangeId;
    }

    public List<Integer> getEventHighBoxExchangeId() {
        return eventHighBoxExchangeId;
    }
}
